//
//  PoolTableView.m
//  RentTable
//
//  Created by mac on 2024/11/29.
//

#import "PoolTableView.h"

@interface PoolTableView()

@property (nonatomic, strong) UIView *poolBackView;
@property (nonatomic, strong) UIImageView *poolImageView;
@property (nonatomic, strong) UIView *poolLabelBackview;
@property (nonatomic, strong) UILabel *poolLabel;
@end

@implementation PoolTableView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self == [super initWithFrame:frame]) {
        [self setUI];
    }
    return self;
}

- (void)setPoolImage:(NSString *)poolimage price:(NSString *)price {
    self.poolImageView.image = [UIImage imageNamed:poolimage];
    self.poolLabel.text = price;
    
}

- (void)setRentModel:(RentModel *)rentModel {
    _rentModel = rentModel;
    self.poolImageView.image = [UIImage imageNamed:rentModel.rentImage];
    self.poolLabel.text = [NSString stringWithFormat:@"¥%.1f/天",rentModel.rentPrice];
}

- (void)setUI {
    self.poolBackView = [UIView new];
    self.poolBackView.backgroundColor = myRGBHex(0x2866E3);
    self.poolBackView.layer.cornerRadius = 10;
    self.poolBackView.layer.masksToBounds = true;
    [self addSubview:self.poolBackView];
    [self.poolBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
    
    self.poolImageView = [UIImageView new];
    self.poolImageView.layer.cornerRadius = 10;
    self.poolImageView.layer.masksToBounds = true;
    [self.poolBackView addSubview:self.poolImageView];
    [self.poolImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.trailing.mas_equalTo(0);
        make.bottom.mas_equalTo(-20);
    }];
    
    self.poolLabelBackview = [UIView new];
    [self.poolBackView addSubview:self.poolLabelBackview];
    self.poolLabelBackview.frame = CGRectMake(13, 70, 73, 22);
    [CommondHandle gradientTheView:self.poolLabelBackview bounds:self.poolLabelBackview.bounds colors:@[myRGBHex(0xE375FF),myRGBHex(0xFF0AA1)] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) hasCornerRadius:11 shouldTakeBack:false];
    
    self.poolLabel = [UILabel new];
    self.poolLabel.textAlignment = NSTextAlignmentCenter;
    self.poolLabel.font = [UIFont pingFangSCSemiboldWithSize:12];
    [self.poolBackView addSubview:self.poolLabel];
    self.poolLabel.frame = CGRectMake(13, 70, 73, 22);
    self.poolLabel.textColor = myRGBHex(0xFFFFFF);
    

    
}


@end
